Photographic document imaging system

ABSTRACT

An apparatus and method for processing a captured image and, more particularly, for processing a captured image comprising a document. In one embodiment, an apparatus comprising a camera to capture documents is described. In another embodiment, a method for processing a captured image that includes a document comprises the steps of distinguishing an imaged document from its background, adjusting the captured image to reduce distortions created from use of a camera and properly orienting the document is described.

CROSS REFERENCE TO RELATED APPLICATIONS

This is a continuation application of U.S. patent application Ser. No.10/928,761, filed Aug. 26, 2004, now U.S. Pat. No. 7,593,595 which isincorporated herein by reference.

FIELD

An apparatus and method for processing a captured image and, moreparticularly, for processing a captured image comprising a document.

BACKGROUND

FIG. 1-A is a block diagram depicting typical components of a scanner. Ascanner is typically used to capture an image of a document 110. Adocument 110 is placed on the scanner plate 112. A scan head 120, whichis generally comprised of an optical subsystem 122 and a charge-coupleddevice (“CCD”) 124, is moved across the document 110. Although FIG. 1Adepicts only a two dimensional view, the scan head 120 may move acrossthe document in both the direction illustrated by arrow 114 and in adirection orthogonal to the document 110. The optical subsystem 122focuses light reflected from document 110 onto a CCD 124. CCD 124 isoften implemented as a two-dimensional array of photosensitivecapacitive elements. When light is incident on the photosensitiveelements of the CCD 124, charge is trapped in a depletion region of thesemiconductor elements. The amount of charge associated with thephotosensitive capacitive elements is related to the intensity of lightincident on the respective elements received over a sampling period.Accordingly, the image is captured by determining the intensity ofincident light at the respective photosensitive capacitive elements viasampling the elements. The analog information produced by thephotosensitive capacitive elements is converted to digital informationby an analog-to-digital (A/D) converter 130. An A/D converter 130 mayconvert the analog information received from CCD 124 in either a serialor parallel manner. The converted digital information may be stored inmemory 140. The digital information is then processed by a processor 150according to control software stored in ROM 180. The user may controlscanning parameters via user interface 170 and the scanned image isoutputted through output port 160.

A block diagram of a digital camera is depicted in FIG. 1B. An opticalsubsystem 122 of a digital camera may be used to focus light reflectedfrom a document 110 onto a CCD 124, much as in the scanner. In otherdigital cameras, devices other than a CCD are used to capture the lightreflected from the image, such as CMOS sensors. In the context of adigital camera, as opposed to a scanner, the optical subsystem 122 isnot moved along the surface of the document, as in a scanner. Rather, ina digital camera, the optical system 122 is generally stationary withrespect to the object, such as a document, to be imaged. In addition todigital cameras, photographs captured from film-based cameras may alsobe digitized.

Cameras offer significant advantages over scanners for capturingdocument images and other images. For example, cameras are generallymore portable than scanners. In addition, because scanners require acaptured image to be placed on the scanner plate, cameras are capable ofcapturing a wider array of images than scanners. However, the use ofcameras creates difficulties in image capturing that do not exist whenusing a scanner. For example, light conditions vary when using a camera,whereas the light conditions are generally controlled in scanners. Inaddition, use of a camera introduces image distortions, which may dependon various variables, such as the angle of the camera relative to theimage, the lens used by the camera and its distance from the image,whether the image including a document is situated on a flat or curvedsurface and other factors. Because the scanner utilizes a moving scannerhead, at a fixed distance from a document to be imaged, thesedistortions do not generally occur in scanners.

Therefore, a need exists for an apparatus and method for capturingimages of documents that utilizes the advantages of cameras overscanners, yet reduces the difficulties presented by capturing documentimages via a camera as opposed to a scanner.

BRIEF SUMMARY

An apparatus and method for processing a captured image that comprisesan imaged document are described. In one embodiment, the apparatuscomprises a stationary camera, which is utilized to capture the imageddocument. In another embodiment, a non-stationary camera is utilized tocapture the imaged documents. In yet another embodiment, a method forprocessing a captured image that includes a document comprises the stepsof distinguishing an imaged document from its background, adjusting thecaptured image to reduce distortions created from use of a camera andproperly orienting the document.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A depicts a prior art document scanner.

FIG. 1B depicts a prior art digital camera.

FIG. 2 depicts a general flowchart of a method for processing a capturedimage.

FIG. 3 depicts a flowchart of another embodiment of a method forprocessing a captured image.

FIG. 4 depicts a flowchart of a method of performing segmentation inaccordance with one of the implementations of the method of imaging adocument disclosed herein.

FIG. 5 depicts a flowchart of one method of performing the random sampleconsensus step illustrated in FIG. 4.

FIG. 6 depicts a flowchart of one method of performing the outlierremoval step illustrated in FIG. 4.

FIG. 7 depicts a flowchart for another method of performing segmentationin accordance with the method of imaging a document disclosed herein.

FIG. 8 depicts a flowchart of one method of performing the distortionremoval steps illustrated in FIG. 2 and FIG. 3.

FIG. 9 depicts a flowchart of one method of performing the lines of textstep illustrated in FIG. 3.

FIG. 10 depicts a flowchart of one method of determining whether adocument is properly oriented in an upright manner in accordance withone implementation of the method of imaging a document disclosed herein.

FIG. 11 depicts one embodiment of an apparatus for capturing andprocessing an image including an imaged document.

FIG. 12 depicts a flowchart of one method of determining whether adocument is oriented in an upright manner in accordance with oneimplementation of the method of imaging a document disclosed herein.

FIG. 13 depicts one embodiment of a system for processing a capturedimage.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

Embodiments described herein are operable to process an image capturedfrom a camera that comprises a document. Embodiments described hereinare operable to identify the captured document image from itsbackground. After the captured document image is isolated from itsbackground, embodiments described herein are operable to reduce orremove distortions of the captured document image. After the distortionof the captured document image is corrected, embodiments describedherein are operable to rotate the captured document image to its properorientation. Additionally, embodiments described herein provide the userwith an evaluation of the success of implementing each of the steps inits various embodiments.

FIG. 2 depicts a general flowchart of a method for processing a capturedimage. After start 210, an image is received in step 220. The imagereceived in step 220 comprises a document image. The image may bereceived from various sources. For example, in one embodiment, the imagemay be received from a digital camera. In another embodiment, the imagemay be received from a stationary unit comprising a digital camera. Inyet another embodiment, the image may be received from a film photographthat has been digitized. Step 230 operates to identify the captureddocument image from the remainder of the image, or the background. Step230 is referred to as segmentation. This step 230 may operate to detectthe edges of the captured document image. This step 230 may also operateto crop the background of the image from the captured document image soas to separate the document from its background. Step 240, referred toas distortion removal, operates to reduce or remove the distortions ofthe captured document image. Some of the distortions which this step 240may operate to correct are perspective distortions, lens distortions andlight distortions. Other distortions may also be corrected in this step240. Step 250 operates to correct the orientation of the document. Thisstep 250 may operate to determine whether the captured document imageshould be in a portrait or landscape orientation and to rotate thecaptured document image accordingly. This step 250 may also operate todetermine whether the captured document image is upside down and torotate the captured document image accordingly. In step 260 theprocessed document image is outputted. The processed document image maybe outputted 260 through various means, such as displaying an image ofthe processed document image on a monitor, saving the processed documentimage to a computer file, electronically transmitting the documentimage, or printing the processed document image.

FIG. 3 depicts a flowchart 300 of another embodiment of a method forprocessing a captured image. After start 305, the image is received 310.In step 315 the received image is converted into a device independentbit map. In step 320 segmentation is performed utilizing an edge-basedsegmentation process. The edge-based segmentation 320 process identifiesthe edges of the captured image document to distinguish the captureddocument image from its background.

FIG. 4 depicts a flow chart of one embodiment of an edge basedsegmentation 320. In this embodiment, horizontal and vertical edgepoints are located. This is done by searching for edge points. Edgepoints are determined by identifying portions of the received image thatcontain a transition from the background portion of the received imageto the document portion of the received image. In one embodiment, thereceived image is scanned beginning with the center of the receivedimage 410 and also scanned beginning from the borders of the receivedimage 420. In one embodiment, it is assumed that the document imageoccupies the center of the received image. In another embodiment, it isassumed that the non-text portion of the captured document image has apixel intensity greater than that of its background. In the scanningbeginning from the center of the receive image 410, after finding anarea that can be identified as document pixels, the transition tobackground pixels is searched along the scan. In the scanning beginningfrom the border of the received image 420, an area is identified asbackground pixels and the transition to document image pixels isidentified. The process can be performed utilizing either one or both ofthese scans 410, 420. In one embodiment, the received image is scanned410, 420 both in the horizontal and vertical direction.

A random sample consensus step 430 is then performed. FIG. 5 depicts oneembodiment of the random sample consensus step. In this embodiment, therandom sample consensus 430 is executed by selecting two points atrandom 510 from the edge points selected in step 410 and 420. The lineconnecting these two randomly selected points is then calculated 520. Inone embodiment, angle-distance coordinates are used, where the anglevalue corresponds to the angle of the line segment around the center ofthe received image and the distance value corresponds to the distancefrom the center of the received image to the nearest point in the linesegment. In other embodiments, other coordinate systems may be used,including, for example, Cartesian coordinates or polar coordinate. Thesevalues are then stored. The process of selecting two random points fromthe edge points obtained in 410 and 420 is repeated to obtain asufficient sample group 530. In one embodiment, this process is repeatedfive thousand times, though different sample sizes may be used. Afterthe sampling, the pairs of points that all lie on the same line aregrouped in bins. If the initial edge points selected in 410 and 420accurately represent the edges of the document in the received image,approximately one quarter of the points will be distributed into foursmall ranges corresponding to the four document edges, while theremaining points will be spread generally uniformly over the rest of thepossible coordinates. The four sets of grouped line segments that havethe most grouped line segments 540 and meet a minimum threshold ofgrouped line segments are identified as representing the four edges ofthe document in the received image 550. In one embodiment, thesecollection of line segments are then determined to be the left, right,top and bottom edges according to their relative positions in thereceived image.

After random sample consensus 430 is performed, in one embodiment, anoutlier removal step 440 is performed among the collection of edgepoints to further refine the identification of the document edges. Inone embodiment, depicted in FIG. 6, this is performed by conducting alinear regression between the collection of edge points corresponding toone of the edges of the received document image. In a linear regressiontechnique, a line is drawn attempting to most accurately connect thecollection of edge points 610. If the point furthest from this linearregression line is determined to be a distance sufficiently far from thelinear regression line 620, the point is removed 630 and a new linearregression is performed. This process is repeated until the farthestpoint from the linear regression line is within a threshold value andthe resulting linear regression line is determined to be the edge line.This is performed on each of the four collection of edge pointsrepresenting the four edges of the received image document.

Referring back to FIG. 3, in step 325, a calculation of the accuracy ofthe identification of the edge lines from the edge-based segmentation320 is determined. This step 325 may be referred to as the calculationof the confidence. In one embodiment, the confidence is calculated foreach edge of the received document image and the lowest value isdetermined to be the overall confidence. In another embodiment, thehighest confidence value among the edge lines is determined to be theoverall confidence. In yet another embodiment, a combination of theconfidence of the edge lines is used, such as for example an average ofthe confidence for the line edges, to determine the overall confidence.One embodiment for calculating the confidence of the determination of aparticular line edge is to calculate the ratio between the number ofpixel points remaining in that edge's collection after outlier removal440 and the total number of pixel points that could have been found onthat edge. The confidence determination can be used to improve thedistortion removal 240, 350 of the received document image and can alsobe used to inform a user of the accuracy of the performance of thesystem for a particular received image. In step 330, if the confidencein the edge-based segmentation step 320 is not sufficiently high, then acontent-based segmentation of step 335 is performed.

The content-based segmentation step 335, one embodiment of which isdepicted in FIG. 7, identifies the text of the captured image documentand calculates the edge of the captured image document in relation tothe text. This is accomplished by identifying connected components inthe received document image 710 and finding the nearest neighbor tothose components 720. The connected components generally refers to thoseblack or dark pixels that are adjacent to one another. Those adjacentpixels are then connected into lines 730, which are then used todetermine the border of the text 740. From these borders, a margin isadded 750 in order to identify the location of the edge of the receiveddocument image. Although the size of the margin may vary, in oneembodiment, a standard margin is added in step 750.

In step 340 the corners of the captured document image are calculated.In one embodiment, the corners may be calculated from the intersectionof the edge lines.

The distortion removal 240, 350 step may involve a various number ofadjustments to the received image. In one embodiment, the distortionremoval 240, 350 will adjust the received document image to correct forperspective distortions in the received image. For example, insituations where the picture is not taken at an angle directly above andcentered upon the document, there will be a perspective distortion ofthe received document image.

One embodiment for adjusting the image to correct for perspectivedistortion is depicted in FIG. 8. This embodiment involves mapping a setof image coordinates 810, for example (x, y), to a new set of imagecoordinates, for example (u, v). After the segmentation step 230, 320,335 the four corners of the document are determined 340. Typically, in adocument containing perspective distortion, these four corners willcorrespond to a trapezoid, whereas a document should generally have theshape of a rectangle. Thus, in one embodiment, the mapping 810 isperformed between the received trapezoid to the desired rectangle. Oneembodiment for accomplishing this mapping 810 is to utilize ahomogeneous transformation between the non-distorted pixel coordinatesand the distorted pixel coordinates via a homogeneous matrixrepresenting the transform from the distorted pixel coordinate to thenon-distorted pixel coordinate, which is known in the art. The transformcan be calculated by comparing the four corners determined duringsegmentation 230, 320, 335 with a corrected dimensions of thenon-distorted received document image. In one embodiment, the need forcalculating the transform at each pixel point can be avoided by simplycalculating the transform for each line and utilizing linearinterpolation to calculate the new pixel coordinates. After mapping newcoordinates corresponding to a document having a reduced perspectivedistortion, a re-sampling of the pixels is performed 815.

Another aspect of the received image that may be adjusted in thedistortion removal 240, 350 step is an adjustment for distortions causedby the camera lens 820. The distortion caused by a camera lens maycreate otherwise straight lines to curve. This distortion depends on theparticular lens used and the distance of the camera from the capturedimage. The curvature created by lens distortion will generally be radialand, therefore, a uniform radial adjustment for the lens distortion canbe performed using a parameter approximating the degree of lensdistortion. This parameter may be either calculated by the system orinputted by the user.

Yet another aspect of the received image that may be adjusted in thedistortion removal 240, 350 step is an adjustment for distortions causedby the document not being entirely flat. For example, if the imageddocument is a page in a book, the page may have a curvature that createsa distortion when captured photographically. This distortion may also becorrected in the distortion removal step 240, 350. Other distortions mayalso be corrected and the description of particular types of distortionherein is not intended to limit the types of distortion that may bereduced or removed.

In step 365, a thresholding process is performed on the image created instep 360. The thresholding process 365 reduces the color depth of theimage and has the potential advantage of reducing the distortion createdby a flash that may be used when photographing the image. In oneembodiment, the thresholding process 365 reduces the twenty-four bitcolor images to one bit black-and-white images. The potential benefitsof reducing the images to black and white is the reduction of theeffects introduced by the camera's flash and the reduction of the amountof information required by the system 300 to process. The thresholding365 can be performed in a number of ways. One embodiment may utilize adithering technique, which is known in the art. An example of adithering technique may be found in existing image software, such as theSNOWBOUND® IMAGE LIBRARY by Snowbound Software Corporation. Oneshortcoming of using a dithering technique, however, is the introductionof noise into the image. Another embodiment for thresholding 365involves selecting a global threshold for an image. In such a technique,a threshold value is selected. Those pixels having an intensity greaterthan the threshold value are deemed white and the remaining pixels aredeemed black. The threshold value may be selected in a number of ways.In one embodiment, the threshold value is selected and applied for allreceived images. This technique has the shortcoming of not accountingfor the varied light conditions in the received images. In anotherembodiment, the threshold value is calculated from an analysis of thereceived image, such as its histogram. In one such embodiment involvingthe analysis of the received image, an assumption is made that thereceived image contains two peaks in its intensity histogramcorresponding to the foreground and background of the received documentimage. This embodiment may not perform well for those images to whichthe assumption does not apply. Another embodiment for thresholding 365is to select a separate threshold value for each pixel in the receivedimage. This embodiment has the advantage of responding to changingconditions within the document, such as lighting changes or backgroundcontrasts. One embodiment of this technique is referred to as adaptivethresholding. In this embodiment, the previous pixel values areconsidered as each new pixel is analyzed for determination of thethreshold value. One way to accomplish this is by calculating theweighted average of each pixel as each progressive pixel of the receivedimage is analyzed. One potential shortcoming of this embodiment is theintroduction of noise if the received image comprises a coloreddocument.

In step 370 the lines of text step is performed. In this step 370, thesystem determines the lines of text in the received document image. FIG.9 depicts one embodiment of the lines of text 370. In one embodiment,the system assumes that the pixels corresponding to text in the receiveddocument image have a lower intensity than the background pixels of thereceived document image. In this embodiment, the sum of the intensitiesof all of the pixels within each of the rows of the received documentimage is calculated 910. These sums are then used to identify localpeaks and valleys in the pixel intensity 920. These peaks and valleysare then analyzed to determine the lines of text in the document. Forexample, if the received document image has black lines of text with awhite background, the lines of pixels that are entirely white will havethe highest total intensities and the lines containing the black textwill have substantially lower pixel intensity. These differences inintensity can then be calculated and the lines of text can thereby bedetermined. In a preferred embodiment, the lines of text 370 is executedboth horizontally and vertically across the received document image.

Another embodiment for performing lines of text 370 is to perform asimilar search for the lines of text as that performed in step 335. Inone such embodiment, the text of the captured document image isidentified and formed into lines. This may be accomplished byidentifying the connected components in the captured document image andfinding the nearest neighbor to those components. The connectedcomponents generally refer to those black or darker pixels that areadjacent to one another. Those adjacent pixels are then connected intolines. This process is similar to that described in steps 710, 720 and730 of FIG. 7.

Step 375 determines whether the captured document image should be in alandscape or portrait format. In one embodiment, this is accomplished bycomparing the result of the lines of text 370 result in the verticaldirection with the lines of text 370 result in the horizontal direction.In one embodiment, the direction resulting with the greater number oflines is determined to define the received document image's orientation.For example, in a received document image that has a height greater thanits width, if the lines of text 370 in the vertical direction yields agreater number of lines than the lines of text 370 in the horizontaldirection, then the received image document is determined to havelandscape orientation. As another example, if in the same received imagedocument the lines of text 370 in the horizontal direction yields agreater number of lines than the lines of text 370 in the verticaldirection, then the received image document is determined to have aportrait orientation.

Step 380 determines the upright orientation of the document. FIG. 10depicts one embodiment of determining whether the received documentimage is properly oriented upright 380. In one embodiment, each line oftext is analyzed. A fewer number of lines of text may be analyzed, butthis may result in a less reliable result. In one embodiment, each lineof text is divided into three sections 1010: an ascending section, amiddle section and a descending section. English language characterscontain certain inherent statistical characteristics that may be used incertain embodiments to determine the upright orientation of the receiveddocument image. For example, the English language alphabet has only fivecharacters that descend below the bottom boundary of a sentence (i.e. g,j, p, q and y) and has many more characters that ascend above the topboundary of a sentence (e.g. b, d, f, h, i, k, l). In one embodiment,this characteristic of the English language characters can be consideredwhen calculating the respective number of pixels contained in theascending section and the descending section 1020 and comparing thosepixel densities 1030, 1040. For example, a received document imagehaving English language characters that has more ascending characterpixels than descending character pixels is likely in the uprightposition and does not need to be rotated, whereas if the same documenthas more descending character pixels than ascending character pixels,the document likely needs to be rotated one-hundred and eighty degrees1050.

In other embodiments, other characteristics of English languagecharacters can also be considered. For example, characteristics of pixellocation in the horizontal direction can be considered. Further,non-statistical methods can also be used to determine the uprightorientation of the document, such as optical character recognition(“OCR”). Another embodiment could utilize a neural net approach. Inaddition, similar inherent characteristics can be utilized fornon-English documents. For example, Spanish language characters aresimilar to those in English and will have similar inherentcharacteristics. As another example, Arabic language characters containa greater number of descending characters and embodiments may adjust forthose characteristics accordingly.

FIG. 12 depicts another embodiment for performing step 380 anddetermining whether the received document image is properly orientedupright 380. In one embodiment, the connected components are used todetermine each letter line of text. Each component is classified byheight into two categories, small and large 1210. The center of thelines of text are determined 1220. In one embodiment, the small letters'heights are used to determine the center of the line of text 1220. Thismay improve the estimate of the line-of-text's center if it isdistorted, such as if it is curved across the page. The large lettersare then matched against the center of the lines of text, and aregrouped as ascending or descending based on the relative location tothis center 1230. The total number of ascending and descending lettersare calculated. In a typical English language document, the largecharacters will ascend towards the top of the page. Therefore, in oneembodiment, if the number of ascending large characters is greater thanthe number of descending ones, then the document does not need to berotated in step 385 prior to outputting in step 390. If, however, thenumber of descending large characters is greater than the number ofascending larger characters, then the document is rotated in step 385prior to outputting in step 390.

The image is then rotated in step 385 according the determinations ofsteps 380 and 375. The new document image is then outputted 390.

As discussed above, the system imaged documents may be captured ineither a film camera or digital camera. As an alternative to thesefreeform devices, a stationary camera system may be employed to capturethe imaged documents. FIG. 11 depicts an embodiment for a stationarycamera system for capturing a document image. In this embodiment, thedocument 1110 is placed on the base 1120 of the system. In a preferredembodiment, the base 1120 of the system is of a pre-determined color,which may have the advantage of facilitating the segmentation process,discussed above. Extending from the base 1120 is the stand 1130, whichmay house a camera 1140 and lighting 1150. The camera and lighting maybe permanently housed in the stand 1130 or may be removable oradjustable. The lighting may be placed anywhere on the base 1120 orstand 1130. In another embodiment, no additional lighting is included onthe base 1120 or stand 1130. In still another embodiment, the lightingis separate from the base 1120 or stand 1130. The stationary system isthen coupled to a computer 1160 to perform the above-describedprocessing of the received image document. In another embodiment, thecomputer may also be built into the apparatus. In still anotherembodiment, the captured image document may simply be stored either inthe digital camera 1140 or in another memory source and later coupled toa computer for processing. Such a stationary camera system can be placedas part of a user's workstation in, for example, an office.

There are several advantages of utilizing a stationary camera system asopposed to a freeform camera. For example, in utilizing a stationarycamera system, the amount of perspective distortion may be reduced,since the document is more likely to be perpendicular and centered withrespect to the camera lens. In addition, another advantage may be toallow the system to better adjust for lens distortion, since thedistance between the camera and the lens used will be known, therebyreducing the need to calculate or approximate these parameters. Anotherpotential advantage would be to reduce the distortions created by acamera flash. In a preferred embodiment the lighting 1150 of thestationary system would be positioned so as to reduce glare and otherdistortions created by camera flashes.

The approach described herein for processing a captured image isapplicable to any type of processing application and (withoutlimitation) is particularly well suited for computer-based applicationsfor processing captured images. The approach described herein may beimplemented in hardware circuitry, in computer software, or acombination of hardware circuitry and computer software and is notlimited to a particular hardware or software implementation.

FIG. 13 is a block diagram that illustrates a computer system 1300 uponwhich an embodiment of the invention may be implemented. Computer system1300 includes a bus 1345 or other communication mechanism forcommunicating information, and a processor 1335 coupled with bus 1345for processing information. Computer system 1300 also includes a mainmemory 1320, such as a random access memory (RAM) or other dynamicstorage device, coupled to bus 1345 for storing information andinstructions to be executed by processor 1335. Main memory 1320 also maybe used for storing temporary variables or other intermediateinformation during execution of instructions to be executed by processor1335. Computer system 1300 further includes a read only memory (ROM)1325 or other static storage device coupled to bus 1345 for storingstatic information and instructions for processor 1335. A storage device1330, such as a magnetic disk or optical disk, is provided and coupledto bus 1345 for storing information and instructions.

Computer system 1300 may be coupled via bus 1345 to a display 1305, suchas a cathode ray tube (CRT), for displaying information to a computeruser. An input device 1310, including alphanumeric and other keys, iscoupled to bus 1345 for communicating information and command selectionsto processor 1335. Another type of user input device is cursor control1315, such as a mouse, a trackball, or cursor direction keys forcommunication of direction information and command selections toprocessor 1335 and for controlling cursor movement on display 1305. Thisinput device typically has two degrees of freedom in two axes, a firstaxis (e.g. x) and a second axis (e.g. y), that allows the device tospecify positions in a plane.

The methods described herein are related to the use of computer system1300 for processing a captured image. According to one embodiment, theprocessing of the captured image is provided by computer system 1300 inresponse to processor 1335 executing one or more sequences of one ormore instructions contained in main memory 1320. Such instructions maybe read into main memory 1320 from another computer-readable medium,such as storage device 1330. Execution of the sequences of instructionscontained in main memory 1320 causes processor 1335 to perform theprocess steps described herein. One or more processors in amulti-processing arrangement may also be employed to execute thesequences of instructions contained in main memory 1320. In alternativeembodiments, hard-wired circuitry may be used in place of or incombination with software instructions to implement the embodimentsdescribed herein. Thus, embodiments described herein are not limited toany specific combination of hardware circuitry and software.

The term “computer-readable medium” as used herein refers to any mediumthat participates in providing instructions to processor 1335 forexecution. Such a medium may take many forms, including, but limited to,non-volatile media, volatile media, and transmission media. Non-volatilemedia includes, for example, optical or magnetic disks, such as storagedevice 1330. Volatile media includes dynamic memory, such as main memory1320. Transmission media includes coaxial cables, copper wire and fiberoptics, including the wires that comprise bus 1345. Transmission mediacan also take the form of acoustic or light waves, such as thosegenerated during radio wave and infrared data communications.

Common forms of computer-readable media include, for example, a floppydisk, a flexible disk, hard disk, magnetic tape, or any other magneticmedium, a CD-ROM, any other optical medium, punch cards, paper tape, anyother physical medium with patterns of holes, a RAM, a PROM, and EPROM,a FLASH-EPROM, any other memory chip or cartridge, a carrier wave asdescribed hereinafter, or any other medium from which a computer canread.

Various forms of computer readable media may be involved in carrying oneor more sequences of one or more instructions to processor 1335 forexecution. For example, the instructions may initially be carried on amagnetic disk of a remote computer. The remote computer can load theinstructions into its dynamic memory and send the instructions over atelephone line using a modem. A modem local to computer system 1300 canreceive the data on the telephone line and use an infrared transmitterto convert the data to an infrared signal. An infrared detector coupledto bus 1345 can receive data carried in the infrared signal and placethe data on bus 1345. Bus 1345 carries the data to main memory 1320,from which processor 1335 retrieves and executes the instructions. Theinstructions received by main memory 1320 may optionally be stored onstorage device 1330 either before or after execution by processor 1335.

Computer system 1300 also includes a communication interface 1340coupled to bus 1345. Communication interface 1340 provides a two-waydata communication coupling to a network link 1375 that is connected toa local network 1355. For example, communication interface 1340 may bean integrated services digital network (ISDN) card or a modem to providea data communication to a corresponding type of telephone lines. Asanother example, communication interface 1340 may be a local areanetwork (LAN) card to provide a data communication connection to acompatible LAN. Wireless links may also be implemented. In any suchimplementation, communication interface 1340 sends and receiveselectrical, electromagnetic or optical signals that carry digital datastreams representing various types of information.

Network link 1375 typically provides data communication through one ormore networks to other data services. For example, network link 1375 mayprovide a connection through local network 1355 to a host computer 1350or to data equipment operated by an Internet Service Provider (ISP)1365. ISP 1365 in turn provides data communication services through theworld wide packet data communication network commonly referred to as the“Internet” 1360. Local network 1355 and Internet 1360 both useelectrical, electromagnetic or optical signals that carry digital datastreams. The signal through the various networks and the signals onnetwork link 1375 and through communication interface 1340, which carrythe digital data to and from computer system 1300, are exemplary formsof carrier waves transporting the information.

Computer system 1300 can send messages and receive data, includingprogram code, through the network(s), network link 1375 andcommunication interface 1340. In the Internet example, a server 1370might transmit requested code for an application program throughInternet 1360, ISP 1365, local network 1355 and communication interfaced1340. In accordance with the invention, one such downloaded applicationprovides for processing captured images as described herein.

The receive code may be executed by processor 1335 as it is received,and/or stored in storage device 1330, or other non-volatile storage forlater execution. In this manner, computer system 1300 may obtainapplication code in the form of a carrier wave.

1. A method for processing a captured image that comprises an imageddocument with perspective distortion; said method comprising: detectinggraphical information in the captured image relating to the transitionbetween said imaged document and the remainder of said captured image;selecting one or more lines from said graphical informationcorresponding to edges of said imaged document; calculating corners ofsaid imaged document based on intersections of said one or more linescorresponding to edges of said imaged document; isolating said imageddocument from background of said captured image based on said one ormore lines corresponding to edges of said imaged document; computingdeviations of said imaged document from a non-distorted perspective ofsaid imaged document; and generating a new image of said imaged documentwith reduced perspective distortion based on said computed deviations.2. A method recited in claim 1, wherein the step of generating a newimage of said imaged document with reduced perspective distortion basedon said computed deviations comprises the process of: mappingcoordinates of pixels of said imaged document to coordinatescorresponding to a non-distorted perspective of said imaged documentbased on said computed deviation.
 3. A method recited in claim 1,further comprises the steps of: converting said non-distorted imageddocument into a two-color representation of said imaged document;calculating pixel intensity of said two-color representation along thevertical axis of said non-distorted imaged document; calculating pixelintensity of said two-color representation along the horizontal axis ofsaid non-distorted imaged document; identifying contrasts in pixelintensities along vertical and horizontal axes of said non-distortedimaged document; identifying lines of text of said imaged document basedon said contrasts in pixel intensities; determining format of saidnon-distorted imaged document based on the direction of said lines oftext of said non-distorted imaged document with respect to dimensions ofsaid edges of said imaged document; rotating said non-distorted imageddocument according to said determination of format of said non-distortedimaged document.
 4. The method recited in claim 3, further comprisingthe steps of: dividing said lines of text into three portions along thelongitudinal axis of said lines of text; determining orientation of saidlines of text based on a comparison of pixel intensities of saidportions of said lines of text; rotating said non-distorted imageddocument based on said determination of orientation.
 5. A non-transitorycomputer readable storage medium for processing a captured image, saidcaptured image comprising an imaged document, the computer readablestorage medium carrying one or more sequences of one or moreinstructions which, when executed by one or more processors, cause theone or more processors to perform the computer-implemented steps of:detecting graphical information in the captured image relating to thetransition between said imaged document and the remainder of saidcaptured image; selecting one or more lines from said graphicalinformation corresponding to edges of said imaged document; calculatingcorners of said imaged document based on intersections of said one ormore lines corresponding to edges of said imaged document; isolatingsaid imaged document from background of said captured image based onsaid one or more lines corresponding to edges of said imaged document;computing deviations of said imaged document from a non-distortedperspective of said imaged document; and generating a new image of saidimaged document with reduced perspective distortion based on saidcomputed deviations.
 6. An apparatus for processing a captured image,said captured image comprising an imaged document, said apparatuscomprising: one or more processors; and a memory communicatively coupledto the one or more processors, the memory including one or moresequences of one or more instructions which, when executed by the one ormore processors, cause the one or more processors to perform the stepsof: detecting graphical information in the captured image relating tothe transition between said imaged document and the remainder of saidcaptured image; selecting one or more lines from said graphicalinformation corresponding to edges of said imaged document; calculatingcorners of said imaged document based on intersections of said one ormore lines corresponding to edges of said imaged document; isolatingsaid imaged document from background of said captured image based onsaid one or more lines corresponding to edges of said imaged document;computing deviations of said imaged document from a non-distortedperspective of said imaged document; and generating a new image of saidimaged document with reduced perspective distortion based on saidcomputed deviations.